import java.io.UnsupportedEncodingException;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
import java.util.Stack;

public class Solution {

    public Asn handler() {
        return null;
    }

    public static void main(String[] args) throws UnsupportedEncodingException, NoSuchMethodException {
        Solution model = new Solution();
        System.out.println(model.multi("12", "23"));
        System.out.println(model.multi(Integer.MAX_VALUE + "", Integer.MAX_VALUE + ""));
        System.out.println(BigDecimal.valueOf(Integer.MAX_VALUE).multiply(new BigDecimal(Integer.MAX_VALUE)));
        System.out.println(new Random().nextInt(1000));
        System.out.println(new Date());

        String url = "qms/upload/65d30b958ae2422abe137e0cb89e9c70/IMG_0080.JPG";
        int index = url.lastIndexOf(".");
        System.out.println(url.substring(index));

    }

    private String multi(String a, String b) {
        if (a.length() < b.length()) {
            return multi(b, a);
        }
        int bit = 0;
        StringBuffer res = new StringBuffer();
        for (int i = b.length() - 1; i >= 0; i--) {
            char c_1 = b.charAt(i);
            int high = 0;
            StringBuffer buffer = new StringBuffer();
            for (int j = a.length() - 1; j >= 0; j--) {
                char c_2 = a.charAt(j);
                int temp = (c_1 - '0') * (c_2 - '0') + high;
                buffer.append(temp % 10);
                high = temp / 10;
            }
            if (high > 0) {
                buffer.append(high);
            }
            buffer.reverse();
            for (int j = 0; j < bit; j++) {
                buffer.append('0');
            }
            res = add(res, buffer);
            bit++;
        }
        return res.toString();
    }

    private StringBuffer add(StringBuffer a, StringBuffer b) {
        if (a.length() < b.length()) {
            return add(b, a);
        }
        a.reverse();
        b.reverse();
        int high = 0;
        for (int i = 0; i < b.length(); i++) {
            int val = (a.charAt(i) - '0') + (b.charAt(i) - '0') + high;
            a.setCharAt(i, (char) (val % 10 + '0'));
            high = val / 10;
        }

        for (int i = b.length(); i < a.length(); i++) {
            int val = (a.charAt(i) - '0') + high;
            a.setCharAt(i, (char) (val % 10 + '0'));
            high = val / 10;
        }
        if (high > 0) {
            a.append(high);
        }
        return a.reverse();
    }

    private static abstract class Teacher<T> {

        public Class<T> get() {
            Type genericSuperclass = getClass().getGenericSuperclass();
            Class<T> tClass = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass())
                .getActualTypeArguments()[0];

            return (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];
        }
    }

    private static class Teacher1 extends Teacher<Integer> {

    }

    private static class Teacher2 extends Teacher<String> {

    }


    private static List<Asn> getData() {
        List<Asn> list = new ArrayList<>();
        Asn asn;

        asn = new Asn(799694772470861824L, "ASN21011501842", "940314",
            "https://ddmc-dynamic-chain-1256883318.cos.ap-shanghai.myqcloud.com/wms7e498d4cfc1f40f4a389eb81b79bca28/wms.ddxq.mobi/image/blob?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDQcvykPeufEXRDkPGdx0nb9QYS6uY3rjK%26q-sign-time%3D1610877081%3B1697277081%26q-key-time%3D1610877081%3B1697277081%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3D71baaba805af4e009b82320c64a5a29ba66bbe14",
            "https://ddmc-dynamic-chain-1256883318.cos.ap-shanghai.myqcloud.com/wms7d3c3214fbd04edea6ace690f76abfb6/wms.ddxq.mobi/image/blob?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDQcvykPeufEXRDkPGdx0nb9QYS6uY3rjK%26q-sign-time%3D1610877238%3B1697277238%26q-key-time%3D1610877238%3B1697277238%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3Dda98ade100daf7741a04f7cdf3131834de9422ab");
        list.add(asn);
        asn = new Asn(800100722910486528L, "ASN2101150184201", "940314",
            "https://ddmc-dynamic-chain-1256883318.cos.ap-shanghai.myqcloud.com/wms188b8e758c86468884c152ec99ca1460/wms.ddxq.mobi/image/blob?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDQcvykPeufEXRDkPGdx0nb9QYS6uY3rjK%26q-sign-time%3D1610877051%3B1697277051%26q-key-time%3D1610877051%3B1697277051%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3D33a2c8a4ef23edf47a80db66cf91d114a8317a92",
            "https://ddmc-dynamic-chain-1256883318.cos.ap-shanghai.myqcloud.com/wmsce6ad938ecd54ec9adffb760c04e5d70/wms.ddxq.mobi/image/blob?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDQcvykPeufEXRDkPGdx0nb9QYS6uY3rjK%26q-sign-time%3D1610877254%3B1697277254%26q-key-time%3D1610877254%3B1697277254%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3Da03627614678d74dc2efa081880db5f6846db992");
        list.add(asn);
        return list;
    }

    private static String getKey(String source) throws UnsupportedEncodingException {
        String decode = URLDecoder.decode(source, "UTF-8");
        if (decode.startsWith("https://") || decode.startsWith("http://")) {
            int start = decode.startsWith("https://") ? 8 : 7;

            int end = decode.indexOf(".cos");
            String sub1 = decode.substring(start, end);

            int i = decode.indexOf(".com/");
            end = decode.indexOf("?");
            String sub2 = decode.substring(i + 5, end);

            return sub1 + "@" + sub2;
        }

        //        System.out.println(decode);
        return source;
    }

    public static void rotate(int[] nums, int k) {
        if (k % nums.length == 0) {
            return;
        }
    }

    public static int trailingZeroes(int n) {
        int count = 0;
        for (int i = 5; i <= n; i = i + 5) {
            for (int temp = i; temp % 5 == 0; temp /= 5) {
                count++;
            }
        }
        return count;
    }

    public static int titleToNumber(String s) {
        char[] chars = s.toCharArray();
        int sum = 0;
        for (int i = 0; i < chars.length; i++) {
            int num = chars[i] - 'A' + 1;
            sum = sum * 26 + num;
        }
        return sum;
    }

    static class Student {

        public Long id;
        public Date age;
        public String name;

        public Student(Long id, Date age, String name) {
            this.id = id;
            this.age = age;
            this.name = name;
        }

        public Long getId() {
            return id;
        }

        public void setId(Long id) {
            this.id = id;
        }

        public Date getAge() {
            return age;
        }

        public void setAge(Date age) {
            this.age = age;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }
    }

    public static int majorityElement(int[] nums) {
        int count = 1;
        int anchor = nums[0];
        for (int i = 1; i < nums.length; i++) {
            if (count == 0) {
                count++;
                anchor = nums[i];
            } else if (anchor != nums[i]) {
                count--;
            } else {
                count++;
            }
        }
        return anchor;
    }

    public static String convertToTitle(int n) {
        int num = n;
        StringBuffer buffer = new StringBuffer();
        for (; ; ) {
            if (num == 0) {
                return buffer.reverse().toString();
            }
            int mod = (num - 1) % 26;
            buffer.append((char) ('A' + mod));
            num = (num - 1) / 26;
        }
    }

    public static int[] twoSum(int[] numbers, int target) {
        if (numbers.length == 2) {
            return new int[]{1, 2};
        }
        int endIndex = numbers.length - 1;
        for (int beginIndex = 0; beginIndex < numbers.length; beginIndex++) {
            int reduce = target - numbers[beginIndex];
            for (int i = endIndex; i > beginIndex; i--) {
                if (numbers[i] == reduce) {
                    return new int[]{beginIndex + 1, i + 1};
                } else if (numbers[i] < reduce) {
                    endIndex = i;
                    break;
                }
            }
        }
        return null;
    }

    public static Object get() {
        return null;
    }

    public ListNode getIntersectionNode(ListNode headA, ListNode headB) {
        if (headA == null || headB == null) {
            return new ListNode(-1);
        }
        ListNode A = headA;
        while (A != null) {
            ListNode B = headB;
            while (B != null) {
                if (A == B) {
                    return A;
                }
                B = B.next;
            }
            A = A.next;
        }
        return new ListNode(-1);
    }

    class MinStack {

        class Ele {

            public int value, min = Integer.MAX_VALUE;
        }

        Stack<Ele> stack;

        public MinStack() {
            stack = new Stack<>();
        }

        public void push(int x) {
            Ele ele = new Ele();
            ele.value = x;
            ele.min = x;
            if (!stack.isEmpty()) {
                Integer min = getMin();
                ele.min = Math.min(min, x);
            }
            stack.push(ele);
        }

        public void pop() {
            stack.pop();
        }

        public int top() {
            return stack.peek().value;
        }

        public int getMin() {
            return stack.peek().min;
        }
    }

    public boolean hasCycle(ListNode head) {
        if (head == null || head.next == null) {
            return false;
        }
        ListNode target = new ListNode(-1);
        //head = head.next;
        for (; head.next != null; ) {
            if (head.next == target) {
                return true;
            }
            ListNode nowNode = head;
            head = head.next;
            nowNode.next = target;
        }
        return false;
    }

    public static int singleNumber(int[] nums) {
        int sum = 0;
        for (int i = 0; i < nums.length; i++) {
            sum = sum ^ nums[i];
        }
        return sum;
    }

    public static boolean isPalindrome(String s) {
        char[] chars = s.toCharArray();
        int low = 0, high = chars.length - 1;
        for (; low < high; ) {
            if (!((chars[low] >= 97 && chars[low] <= 122)
                || (chars[low] >= 65 && chars[low] <= 90)
                || (chars[low] >= 48 && chars[low] <= 57))) {
                low++;
                continue;
            }
            if (!((chars[high] >= 97 && chars[high] <= 122)
                || (chars[high] >= 65 && chars[high] <= 90)
                || (chars[high] >= 48 && chars[high] <= 57))) {
                high--;
                continue;
            }
            if (((chars[low] >= 48 && chars[low] <= 57) || (chars[high] >= 48 && chars[high] <= 57))
                && chars[low] != chars[high]) {
                return false;
            } else {
                int abs = Math.abs(chars[high] - chars[low]);
                if (abs == 0 || abs == 32) {
                    low++;
                    high--;
                } else {
                    return false;
                }
            }
        }
        return true;
    }

    public static List<Integer> getRow(int rowIndex) {
        rowIndex++;
        List<Integer> list = new ArrayList<>();
        if (rowIndex == 0) {
            return list;
        }
        if (rowIndex == 1) {
            return list;
        }

        int middle = (rowIndex + 1) / 2;
        for (int i = 0; i < middle; i++) {
            long val = 1;
            for (int j = 1; j <= i; j++) {
                val = val * (rowIndex - j) / j;
            }
            list.add((int) val);
        }
        for (int i = middle + 1; i <= rowIndex; i++) {
            list.add(list.get(rowIndex - i));
        }
        // 1
        // 1 1
        // 1 2 1
        // 1 3 3  1
        // 1 4 6  4  1
        // 1 5 10 10 5 1
        // 1 6 15 20 15 6  1
        // 1 7 21 35 35 21 7  1
        // 1 8 28 56 70 56 28 8 1
        // 8 4 5
        // 1
        // 1 1n=6
        // 1 n-4 1
        // 1 n-3 n-3 1
        // 1 n-2 2(n-3) n-2 1
        // 1 n-1 2(n-3)+n-2 2(n-3)+n-2 n-1 1

        //第n行,第i个值，从2开始
        // 1                    1
        return list;
    }

    public static List<List<Integer>> generate(int numRows) {
        List<List<Integer>> lists = new ArrayList<>();
        for (int i = 0; i < numRows; i++) {
            List<Integer> list = new ArrayList<>();
            list.add(1);
            for (int j = 1; j < i; j++) {
                list.add(lists.get(i - 1).get(j - 1) + lists.get(i - 1).get(j));
            }
            if (i > 0) {
                list.add(1);
            }
            lists.add(list);
        }
        return lists;
    }

    public static boolean hasPathSum(TreeNode root, int sum) {
        if (root == null) {
            return false;
        }
        if (root.left == null && root.right == null) {
            if (root.val == sum) {
                return true;
            }
            return false;
        }
        return hasPathSum(root.left, sum - root.val) || hasPathSum(root.right, sum - root.val);
    }

    public static int minDepth(TreeNode root) {
        return root == null ? 0 : (root.left == null && root.right == null) ? 1
            : Math.min(minDepth(root.left) + 1, minDepth(root.right) + 1);
    }

    public static TreeNode sortedArrayToBST(int[] nums) {
        return nums.length == 0 ? null : sortedArrayToBST(nums, 0, nums.length - 1);
    }

    public static TreeNode sortedArrayToBST(int[] nums, int begin, int end) {
        TreeNode node;
        if (begin == end) {
            node = new TreeNode(nums[begin]);
            return node;
        } else if ((begin + 1) == end) {
            node = new TreeNode(nums[end]);
            node.left = new TreeNode(nums[begin]);
            return node;
        }
        int middle = (begin + end) / 2;
        node = new TreeNode(nums[middle]);
        node.left = sortedArrayToBST(nums, begin, middle - 1);
        node.right = sortedArrayToBST(nums, middle + 1, end);
        return node;
    }

    public static List<List<Integer>> levelOrderBottom(TreeNode root) {
        List<List<Integer>> lists = new LinkedList<>();
        if (root == null) {
            return lists;
        }
        levelOrderBottom(root, lists, 1);
        return lists;
    }

    public static void levelOrderBottom(TreeNode root, List<List<Integer>> lists, int level) {
        if (root == null) {
            return;
        }
        List<Integer> list;
        if (lists.size() >= level) {
            list = lists.get(lists.size() - level);
        } else {
            list = new ArrayList<>();
            lists.add(0, list);
        }
        list.add(root.val);
        levelOrderBottom(root.left, lists, level + 1);
        levelOrderBottom(root.right, lists, level + 1);
    }

    public static int maxDepth(TreeNode root) {
        return root == null ? 0 : Math.max(maxDepth(root.left) + 1, maxDepth(root.right) + 1);
    }

    public static boolean isSymmetric(TreeNode root) {
        return root == null ? true : isSymmetric(root.left, root.right);
    }

    public static boolean isSymmetric(TreeNode left, TreeNode right) {
        if (left == null && right == null) {
            return true;
        }
        if (left == null || right == null) {
            return false;
        }
        return (left == null && right == null) ? true : (left == null || right == null) ? false
            : left.val == right.val && isSymmetric(left.left, right.right) && isSymmetric(left.right, right.left);
    }

    public static boolean isSameTree(TreeNode p, TreeNode q) {
        if (p == null && q == null) {
            return true;
        }
        if (p == null || q == null) {
            return false;
        }
        return p.val == q.val && isSameTree(p.left, q.left) && isSameTree(p.right, q.right);
    }

    static class TreeNode {

        int val;
        TreeNode left;
        TreeNode right;

        TreeNode(int x) {
            val = x;
        }
    }

    public static ListNode deleteDuplicates(ListNode head) {
        if (head == null) {
            return null;
        }
        ListNode res = head, pre = null;
        while (head != null) {
            if (pre == null || (head.val != pre.val)) {
                if (pre == null) {
                    pre = head;
                } else {
                    pre.next = head;
                    pre = pre.next;
                }
            }
            head = head.next;
        }
        pre.next = null;
        return res;
    }

    public int climbStairs(int n) {
        int[] ints = new int[n];
        ints[0] = 1;
        ints[1] = 2;
        for (int i = 2; i < ints.length; i++) {
            ints[i] = ints[i - 1] + ints[i - 2];
        }
        return ints[n - 1];
    }

    public static int mySqrt(int x) {
        if (x == 0) {
            return 0;
        }
        double a = x;
        while (true) {
            double i = (a + x / a) / 2;
            if (i == a) {
                return (int) i;
            }
            a = i;
        }
    }

    public static int[] plusOne(int[] digits) {
        digits[digits.length - 1] = digits[digits.length - 1] + 1;
        for (int i = digits.length - 1; i > 0; i--) {
            if (digits[i] > 9) {
                digits[i] = 0;
                digits[i - 1] = digits[i - 1] + 1;
                continue;
            }
            break;
        }
        if (digits[0] > 9) {
            digits[0] = 0;
            int[] res = new int[digits.length + 1];
            System.arraycopy(digits, 0, res, 0, digits.length);
            res[0] = 1;
            return res;
        }
        return digits;
    }

    public static int lengthOfLastWord(String s) {
        if (s.length() == 0 || s.trim().length() == 0) {
            return 0;
        }
        char[] chars = s.toCharArray();
        int count = 0;
        boolean flag = false;
        for (int i = chars.length - 1; i >= 0; i--) {
            if (chars[i] == ' ') {
                if (flag) {
                    break;
                }
            } else {
                count++;
                flag = true;
            }
        }
        return count;
    }

    public static int maxSubArray(int[] nums) {
        if (nums.length == 0) {
            return Integer.MIN_VALUE;
        }
        int sum = nums[0], max = sum;
        for (int i = 1; i < nums.length; i++) {
            sum = Math.max((nums[i] + sum), nums[i]);
            max = Math.max(max, sum);
        }
        return max;
    }

    public static String countAndSay(int n) {
        // "1"
        if (n == 1) {
            return "1";
        }
        String source = "1";

        for (int i = 1; i < n; i++) {
            StringBuffer buffer = new StringBuffer();
            char pre = source.charAt(0);
            int length = source.length();
            int count = 1;
            for (int j = 1; j < length; j++) {
                if (source.charAt(j) == pre) {
                    count++;
                } else {
                    buffer.append(count).append(pre);
                    pre = source.charAt(j);
                    count = 1;
                }
            }
            buffer.append(count).append(pre);
            source = buffer.toString();
        }
        return source;
    }

    public static int searchInsert(int[] nums, int target) {
        int low = 0, high = nums.length;
        if (high == 0 || nums[0] >= target) {
            return 0;
        } else if (nums[high - 1] < target) {
            return high;
        }
        for (; low < high; ) {
            int middle = (low + high) / 2;
            if (nums[middle] == target) {
                return middle;
            } else if (nums[middle] < target) {
                low = middle + 1;
            } else {
                high = middle;
            }
        }
        return low;
    }

    public static int strStr(String haystack, String needle) {
        if (needle.length() > haystack.length()) {
            return -1;
        } else if (needle.length() == 0 || haystack.equals(needle)) {
            return 0;
        }
        // abcasafeafeafdac
        // afeafdac
        char[] chars1 = haystack.toCharArray();
        char[] chars2 = needle.toCharArray();
        for (int i = 0; i < chars1.length; ) {
            if (chars1.length - i < chars2.length) {
                return -1;
            }
            int count = 0, first = 0;
            boolean flag = true;
            for (int j = 0; j < chars2.length; j++) {
                if (count > 0 && first == 0 && chars1[i + count] == chars2[0]) {
                    first = count;
                }
                if (chars1[i + count] == chars2[j]) {
                    count++;
                    continue;
                }
                count++;
                flag = false;
                break;
            }
            if (flag) {
                return i;
            } else {
                i = first == 0 ? i + count : i + first;
            }
        }
        return -1;
    }

    public static int removeElement(int[] nums, int val) {
        if (nums.length == 0) {
            return 0;
        }
        int index = 0;
        for (int i = 0; i < nums.length; i++) {
            if (nums[i] != val) {
                nums[index++] = nums[i];
            }
        }
        return index;
    }

    public static int removeDuplicates(int[] nums) {
        if (nums.length == 0 || nums.length == 1) {
            return nums.length;
        }
        int index = 0, pre = nums[0];
        for (int i = 1; i < nums.length; i++) {
            if (nums[i] != pre) {
                nums[++index] = nums[i];
                pre = nums[i];
            }
        }
        return index + 1;
    }

    public static ListNode mergeTwoLists(ListNode l1, ListNode l2) {
        ListNode head = null, target, pre = null;
        for (; l1 != null && l2 != null; ) {
            target = l1.val > l2.val ? l2 : l1;
            if (head == null) {
                head = pre = target;
            } else {
                pre.next = target;
                pre = target;
            }

            if (l1.val > l2.val) {
                l2 = l2.next;
            } else {
                l1 = l1.next;
            }
        }
        if (pre == null) {
            return l1 != null ? l1 : l2;
        }
        pre.next = l1 != null ? l1 : l2;
        return head;
    }

    public static class ListNode {

        int val;
        ListNode next;

        ListNode(int x) {
            val = x;
        }
    }
}